<template>
  <div class="list-table">
    <div class="area-header">
      <span class="area-header-title">{{ $t('项目简介汇总表') }}</span>
    </div>
    <el-form ref="queryForm" :model="queryParams" :inline="true">
      <el-form-item :label="$t('项目名称')" prop="dealName">
        <el-input v-model="queryParams.dealName" :placeholder="$t('项目名称')" />
      </el-form-item>
      <el-form-item :label="$t('项目状态')" prop="dealStatus">
        <dictSelect
          v-model="queryParams.dealStatus"
          :clearable="true"
          :placeholder="$t('项目状态')"
          dictionary="deal_status"
        />
      </el-form-item>
      <el-form-item :label="$t('关注等级')" prop="levelConcern">
        <dictSelect
          v-model="queryParams.levelConcern"
          :clearable="true"
          :placeholder="$t('关注等级')"
          dictionary="level_concern"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="queryHandle">{{ $t("搜索") }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t("重置") }}</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          v-hasPermi="['deal:introduction:export']"
          type="warning"
          icon="el-icon-download"
          size="mini"
          :disabled="isExport"
          @click="exportHandle('rowList')"
        >{{ $t("批量导出") }}</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          v-hasPermi="['deal:introduction:export']"
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="exportHandle('row')"
        >{{ $t('导出') }}</el-button>
      </el-col>
    </el-row>
    <el-table v-loading="loading" :data="dealIntroductionList" border @selection-change="handleSelectChange">
      <el-table-column type="selection" width="40" align="center" />
      <el-table-column :label="$t('序号')" type="index" fixed="left" align="center" show-overflow-tooltip width="50">
        <template slot-scope="scope">
          {{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('公司名称')" fixed="left" align="center" prop="companyName" show-overflow-tooltip width="200">
        <template slot-scope="scope">
          {{ scope.row.companyName }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('项目名称')" fixed="left" align="center" prop="dealName" show-overflow-tooltip width="200">
        <template slot-scope="scope">
          <router-link
            target="_blank"
            :to="{path:'/deal/home/dealBaseHome',query:{id:scope.row.dealId,companyId:scope.row.companyId}}"
            class="link_a"
          >{{ scope.row.dealName }}</router-link>
        </template>
      </el-table-column>
      <el-table-column :label="$t('团队情况')" align="center" prop="teamSituation" min-width="200" show-overflow-tooltip />
      <el-table-column :label="$t('项目简介')" align="center" prop="dealIntroduction" min-width="200" show-overflow-tooltip />
      <el-table-column :label="$t('项目进展')" align="center" prop="projectProgressCondition" min-width="200" show-overflow-tooltip />
      <el-table-column :label="$t('融资需求')" align="center" prop="financingDemand" min-width="200" show-overflow-tooltip />
      <el-table-column :label="$t('尽调进展')" align="center" prop="diligenceProgress" min-width="200" show-overflow-tooltip />
      <el-table-column :label="$t('厂房需求面积(m²)')" align="center" prop="plantAreaRequired" min-width="150" show-overflow-tooltip>
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.plantAreaRequired) }}</span>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>

  import { dealIntroductionReportList } from '@/api/sass/lanwan/companyThManagement'

  export default {
    data() {
      return {
        // 批量导出条件
        exportList: [],
        isExport: true,
        dealIntroductionList: [],
        total: 0,
        loading: false,
        queryParams: {
          dealName: undefined,
          dealStatus: undefined,
          levelConcern: undefined,
          pageNum: 1,
          pageSize: 10
        }
      }
    },
    mounted() {
      this.getList()
    },
    methods: {
      getList() {
        this.loading = true
        dealIntroductionReportList(this.queryParams).then(res => {
          this.dealIntroductionList = res.rows
          this.total = res.total
          this.loading = false
        }).catch(() => {
          this.loading = false
        })
      },
      /** 搜索按钮操作 */
      queryHandle() {
        this.queryParams.pageNum = 1
        this.getList()
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm('queryForm')
        this.queryHandle()
      },
      /** 导出按钮操作 */
      exportHandle(condition) {
        var exports = {}
        if (condition === 'rowList') {
          exports.exportList = this.exportList
        } else {
          exports = this.queryParams
        }
        this.downLoadExcelPost('/management/companyThManagement/exportDealIntroduction', exports)
      },
      // 多选框选中数据
      handleSelectChange(selection) {
        this.exportList = []
        this.exportList = selection.map(item => item.dealId)
        this.isExport = !selection.length
      }
    }
  }
</script>

<style scoped>

</style>
